﻿using System;
using CARMSBusiness;
using CARMSData.EntityClasses;


namespace CARMS.Admin
{
    [Function("Admin.RoleInfo")]
    public partial class RoleCreate : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {}
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            CloseWindow(false);
        }
        protected void btnSaveType_Click(object sender, EventArgs e)
        {
            if (txtRoleName.Text.Trim().Length == 0)
            {
                base.Alert("Please input the role name!");
            }
            else
            {
                var entity = new RoleEntity();
                entity.RoleName = txtRoleName.Text.Trim();

                if (AdminBusiness.CreateRole(entity))
                {
                    CloseWindow(true);
                }
                else
                {
                    CloseWindow();
                }
            }
        }
    }
}
